package com.ykj.controller;


import com.ykj.dto.Result;
import com.ykj.entity.Comment;
import com.ykj.service.CommentService;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Y2014188432
 * @since 2022-05-14
 */
@RestController
@RequestMapping("/comment")
public class CommentController {

    @Resource
    private CommentService commentService;

    @GetMapping("/getCommentByPostsId")
    public Result getCommentByPostsId(String postsId){
        return commentService.getCommentByPostsId(postsId);
    }

    @PostMapping("/createComment")
    public Result createComment(@RequestBody Comment comment){
        return commentService.createComment(comment);
    }

    @GetMapping("/getAll")
    public Result getAll(){
        return commentService.getAll();
    }

}

